<?php



/**
 * Radcodes - SocialEngine Module
 *
 * @category   Application_Extensions
 * @package    Cmspage
 * @copyright  Copyright (c) 2009-2010 Radcodes LLC (http://www.radcodes.com)
 * @license    http://www.radcodes.com/license/
 * @version    $Id$
 * @author     Vincent Van <vincent@radcodes.com>
 */
 
 
 
class Cmspage_Widget_ListRecentController extends Engine_Content_Widget_Abstract
{

  public function indexAction()
  {
  	
    // Don't render this if not authorized
    $viewer = Engine_Api::_()->user()->getViewer();

    $this->view->items_per_page = $max = $this->_getParam('max', 5);
    $this->view->show_page_details = $this->_getParam('details', 0);
    
    if (!$this->view->items_per_page)
    {
      return $this->setNoRender();
    }
    
    $this->view->paginator = $paginator = Engine_Api::_()->cmspage()->getPublishedCmspagesPaginator(array(
      'order' => 'creation_date',
      'order_direction' => 'DESC',
      'limit' => $this->view->items_per_page,
    ));

       
    $this->view->google_map = $google_map = Engine_Api::_()->getApi('map', 'radcodes')->getInstance('cmspage_widget_listrecent');
    
    
  }

}